<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div class="tab-box">
        <div class="tab-head">
            <div class="tab-head-div current">标签一</div>
            <div class="tab-head-div">标签二</div>
            <div class="tab-head-div">标签三</div>
            <div class="tab-head-div">标签四</div>
        </div>
        <div class="tab—body">
            <div class="tab-body-div current"> 1 </div>
            <div class="tab-body-div"> 2 </div>
            <div class="tab-body-div"> 3 </div>
            <div class="tab-body-div"> 4 </div>
        </div>    
    </div>
    <script>
        var tabs = document.getElementsByClassName('tabs-head-div');
        var divs = document.getElementsByClassName('tabs-body-div');
        for(var i = 0;i < tabs.length;++i){
            tabs[i].onmouseover=function(){
                for(var i = 0;i < divs.length;++i){
                    if(tabs[i] == this){
                        divs[i].classList.add('current');
                        tabs[i].classList.add('current');
                    }else{
                        divs[i].classList.remove('current');
                        tabs[i].classList.remove('current');
                    }
                }
            };
        }
    </script>
    <a href="..\第七章.html">返回上一级</a>
</body>
</html>